<script setup lang="ts">
import {useRoute} from "vue-router";
import {computed, toRef, toRefs} from "vue";

const route = useRoute();
console.log("route.params接收数据:",route.params)
// 方式1：
// 使用计算属性来响应路由查询参数的变化
const id = computed(() => route.params.id)
const title = computed(() => route.params.title)
const content = computed(() => route.params.content)

</script>

<template>
  <div>新闻详情:{{ id }}-----{{title}}-----{{content}}</div>
<!-- 式2：-->
<!--  <div>新闻详情:{{ route.params.id }}-&#45;&#45;{{route.params.title }}-&#45;&#45;{{route.params.content}}</div>-->
</template>

<style scoped>

</style>
